package com.aabte.spring.annotation.config;

import com.aabte.spring.beans.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Scope;

/**
 * @author Daniel
 */
@Configuration
public class PrototypeConfig {

    @Bean(name = "jack")
    // singleton | prototype | request | session
    @Scope("prototype")
    @Lazy
    public Person person() {
        System.out.println("容器实例化Person对象！");
        return Person.builder()
                .name("jack")
                .age(19)
                .build();
    }

}
